# Maintainer: Andrew Sun <adsun701@gmail.com>

_gemname=cairo
_realname=ruby-${_gemname}
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.16.5
pkgrel=1
pkgdesc="Ruby bindings for cairo (mingw-w64)"
arch=('any')
url="https://cairographics.org/rcairo"
license=('Ruby')
depends=("${MINGW_PACKAGE_PREFIX}-ruby"
         "${MINGW_PACKAGE_PREFIX}-cairo"
         "${MINGW_PACKAGE_PREFIX}-ruby-pkg-config")
makedepends=("${MINGW_PACKAGE_PREFIX}-ruby-native-package-installer")
source=("https://rubygems.org/downloads/${_gemname}-${pkgver}.gem")
noextract=("${_gemname}-${pkgver}.gem")
sha256sums=('f11f243d74b6902bb0306c860e17b8be530883a617b0ece1abe488ab40085bba')

package() {
  local _gemdir="$(ruby -e'puts Gem.default_dir')"
  _gemdir="$(cygpath -u ${_gemdir})"
  
  ${MINGW_PREFIX}/bin/gem install --ignore-dependencies --no-user-install -i "${pkgdir}${_gemdir}" -n "${pkgdir}${MINGW_PREFIX}/bin" ${_gemname}-${pkgver}.gem
  
  rm "${pkgdir}${_gemdir}/cache/${_gemname}-${pkgver}.gem"
  
  install -D -m644 "${pkgdir}${_gemdir}/gems/${_gemname}-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/COPYING"
}
